//
//  RNViewController.m
//  TestReactNative
//
//  Created by Juvid on 2016/12/2.
//  Copyright © 2016年 Juvid. All rights reserved.
//

#import "RNViewController.h"
#import "RCTRootView.h"
#import "RCTBundleURLProvider.h"
@interface RNViewController ()

@end

@implementation RNViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"RN跨平台应用";
    self.edgesForExtendedLayout=UIRectEdgeNone;

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        NSURL *jsCodeLocation;
        //    jsCodeLocation = [NSURL URLWithString:@"http://192.168.8.9:8081/index.ios.bundle?platform=ios&dev=true&minify=false"];
        jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"UIView.ios" fallbackResource:nil];

        RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                            moduleName:@"TestReactNative"
                                                     initialProperties:nil
                                                         launchOptions:nil];
        rootView.frame=self.view.bounds;
        
        [self.view addSubview:rootView];
    });


    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
